#include "DataManager.h"
DataManager::DataManager() noexcept {}

DataManager::~DataManager() {}

DataManager& DataManager::GetInstance() noexcept {
  static DataManager instance;
  return instance;
}

void DataManager::Init(DataManagerSettings const& settings) noexcept {
  std::lock_guard<std::mutex> lock(mutex_);
  if (is_init_) return;
  settings_ = settings;
  auto const& sceneNumber{settings.data_scene_paths.size()};
  data_scenes_ptr_ = std::make_shared<std::vector<DataScene>>(sceneNumber);  

  for (size_t i = 0; i < sceneNumber; i++) {
    auto& scene{data_scenes_ptr_->at(i)};
    scene.Init(settings.data_scene_paths.at(i));
    scene.SetRelplay(false);
  }
  is_init_ = true;
}